
#include "menu_widget.h"

#include "about_dialog.h"
#include "hosts_dialog.h"
#include "prefs_dialog.h"

/* FIXME: Use gettext */
#define _(a) (a)

GtkWidget*
create_main_menu ()
{

  GtkWidget *menu_bar;

  GtkWidget *menu_item;
  GtkWidget *menu;

  menu_bar = gtk_menu_bar_new ();
  
  /* Session menu */
    menu = gtk_menu_new ();
    
    menu_item = gtk_menu_item_new_with_mnemonic ("_Manage hosts...");
    g_signal_connect (G_OBJECT (menu_item), "activate",\
     G_CALLBACK (show_hosts_dialog), NULL);
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);

    menu_item = gtk_separator_menu_item_new ();
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
    
    menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL);
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
    g_signal_connect_swapped (G_OBJECT (menu_item), "activate",\
      G_CALLBACK (gtk_main_quit), NULL);

  menu_item = gtk_menu_item_new_with_mnemonic (_("_Session"));  
  gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), menu);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menu_item);
  /* Session menu end */
  
  /* Edit menu */
  menu = gtk_menu_new ();

    menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);

    menu_item =  gtk_image_menu_item_new_from_stock (GTK_STOCK_PASTE, NULL);
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);

    menu_item = gtk_separator_menu_item_new ();
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
    
    menu_item =  gtk_image_menu_item_new_from_stock (GTK_STOCK_PREFERENCES,\
                   NULL);
    g_signal_connect (G_OBJECT (menu_item), "activate",\
     G_CALLBACK (show_prefs_dialog), NULL);
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);

  menu_item = gtk_menu_item_new_with_mnemonic (_("_Edit"));
  gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), menu);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menu_item);
  /* Edit menu end */
  
  /* Help menu */
  menu = gtk_menu_new ();

    menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
    g_signal_connect (G_OBJECT (menu_item), "activate",\
     G_CALLBACK (show_about_dialog), NULL);
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
  
  menu_item = gtk_menu_item_new_with_mnemonic (_("_Help"));
  gtk_menu_item_set_submenu (GTK_MENU_ITEM(menu_item), menu);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menu_item);
  /* Help menu end */
  
  return menu_bar;
  
}

